<?php 
    $dateTimeNow = MyDateTime::getCurrentTime('now', false); 
    $dateTimeDest = MyDateTime::getCurrentTime('2013-10-01 08:00', false);
    //$dateTimeDest->setTime(08, 00);
    $interval = $dateTimeDest->diff($dateTimeNow);

    if(isset($_GET['test_count'])){
        echo '<pre>';print_r($dateTimeNow->format("Y-m-d H:i:s"));echo '</pre>';
        echo '<pre>';print_r($dateTimeDest->format("Y-m-d H:i:s"));echo '</pre>';
        echo '<pre>diff:';print_r($interval);echo '</pre>';die;
    }
    if($interval->invert):?>
    <script src="/files/js/jquery-countdown/js/jquery.countdown.js"></script>
    <script type="text/javascript">
        $(function(){
            
            var dateNow = new Date();
            var dateDest = new Date(2013, 09, 28, 08); 
            
var diff=dateDest-dateNow //unit is milliseconds

console.log(diff) 
dateDiff = new Date(diff);
console.log(dateDiff.getDay()) 
console.log(dateDiff.getHours()) 
console.log(dateDiff.getMinutes()) 
console.log(dateDiff.getSeconds()) 
      
            $('#counter').countdown({
                image: '/files/js/jquery-countdown/img/digits.png',
                startTime: '<?php echo $interval->format('%D:%H:%I:%S')?>',
                timerEnd: function(){ $('#countdown').fadeOut(); },
                format: 'mm:ss'
            });
        });
    </script>
    <style type="text/css">
        .cntSeparator {
            font-size: 54px;
            margin: 10px 7px;
            color: #000;
        }
        #counter-desc { margin: 7px 3px; }
        #counter-desc div {
            float: left;
            font-family: Arial;
            width: 70px;
            margin-right: 65px;
            font-size: 13px;
            font-weight: bold;
            color: #000;
        }
    </style>
    <div id="countdown">
        <h2>Ngày khai trương chỉ còn</h2>
        <div id="counter"></div>
        <div id="counter-desc">
            <div>Ngày</div>
            <div>Giờ</div>
            <div>Phút</div>
            <div>Giây</div>
        </div>
        <br/>
        <br/>
        <br/>
    </div>
<?php endif;?>